package com.guapi.util;

public class RedisUtil implements BaseConstant {
    final static private String PREFIX_USER = "user" + SPLIT;

    final static private String PREFIX_EMAIL_ACTIVE = "email" + SPLIT;

    final static private String PREFIX_USER_HEADER = "header" + SPLIT;

    final static private String PREFIX_IN_IP_ADDRESS_COLLECTION = "in_ip_sum";

    final static private String PREFIX_IN_IP_ADDRESS = "in_ip";


    final static private String PREFIX_BAN_IP_ADDRESS = "ban_ip";

    final static public String FIELD_TIME = "time";
    final static public String FIELD_COUNT = "count";


    /**
     * 用户key
     *
     * @param userKey
     * @return
     */
    public static String getUserKey(String userKey) {
        return PREFIX_USER + userKey;
    }

    /**
     * 邮件key
     *
     * @param emailActiveHash
     * @return
     */
    public static String getEmailKey(String emailActiveHash) {
        return PREFIX_EMAIL_ACTIVE + emailActiveHash;
    }

    /**
     * 用户头像key
     *
     * @param userId
     * @return
     */
    public static String getUserHeaderKey(String userId) {
        return PREFIX_USER_HEADER + userId;
    }

    /**
     * 进站ip key
     * @return
     */
    public static String getInWebIp(String ip) {
        return PREFIX_IN_IP_ADDRESS+SPLIT+ip;
    }

    public static String getBanIp() {
        return PREFIX_BAN_IP_ADDRESS;
    }


    /**
     * 进站ip集合，用于寻找进站的ip历史
     * @return
     */
    public static String getInWebIps() {
        return PREFIX_IN_IP_ADDRESS_COLLECTION;
    }

}
